package com.jsu.springboot_medicine.service.impl;
import com.alibaba.druid.util.StringUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jsu.springboot_medicine.dao.DeptDao;
import com.jsu.springboot_medicine.entity.Dept;
import com.jsu.springboot_medicine.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {
        @Autowired
        private DeptDao deptDao;
        Integer pageSize=30;
        @Override
        public void insert(Dept dept) {
            deptDao.insert(dept);
        }

        @Override
        public PageInfo<Dept> selectAll(Integer pageNum) {
            PageHelper.startPage(pageNum,pageSize);
            List<Dept> depts = deptDao.selectAll();
            PageInfo<Dept> deptPageInfo=new PageInfo<>(depts);
            return deptPageInfo;
        }

        @Override
        public void updateByPrimaryKey(Integer deptId) {
            deptDao.updateByPrimaryKey(deptId);
        }
}

